print("Введите строку")
stroka=input()
ko1=ko2=ko3=ko4=kz1=kz2=kz3=kz4=0
S=''
for sim in stroka:
    if sim=='(':
        S=S+sim
        ko1+=1
    if sim=='{':
        S=S+sim
        ko2+=1
    if sim=='[':
        S=S+sim
        ko3+=1
    if sim=='<':
        S=S+sim
        ko4+=1
    if sim==')':
        kz1+=1
    if len(S)>0 and S [len(S)-1]=='(':
            S=S[:-1]
    if sim=='}':
        kz2+=1
        if len(S)>0 and S [len(S)-1]=='{':
            S=S[:-1]
    if sim==']':
        kz3+=1
        if len(S)>0 and S [len(S)-1]=='[':
            S=S[:-1]
    if sim=='>':
        kz4+=1
    if len(S)>0 and S [len(S)-1]=='<':
            S=S[:-1]
if len (S)==0 and ko1==kz1 and ko2==kz2 and ko3==kz3 and ko4==kz4:
            print("Верная")
else:
            print("Неверная")
